package com.hg.strategy.demo1;

/**
 * 客户端
 * created by skh on 2018/3/24
 */
public class Client {

	/**
	 * 以后换算法,只需要重写一个类,实现IStrategy接口即可
	 * @param args
	 */
	public static void main(String[] args) {
		Context context;
		System.out.println("-----执行策略1-----");
		context = new Context(new ConcreteStrategy1());
		context.execute();

		System.out.println("-----执行策略2-----");
		context = new Context(new ConcreteStrategy2());
		context.execute();

		System.out.println("-----执行策略1-----");
		context.setiStrategy(new ConcreteStrategy1());
		context.execute();
	}
}
